package com.xqls.server.dto.send;

import com.xqls.server.dto.SoketCommonDto;
import com.xqls.server.netty.DecoderUtil;

import io.netty.buffer.ByteBuf;

public class ValveChangeDto extends SoketCommonDto{
	
	 /**
     * 远控
     */
    public static  final  String LONG_RANGE="0000";

    /**
     * 自动
     */
    public static  final  String AUTO_MATIC="0001";
    /**
     * 整点采样
     */
    public static  final  String MANUAL="0002";
    
    private  String periodicMode;
    
    /**
     * 处理方式
     */
    private Integer treatment ;
    /**
     * 0x02 0x00
     */
    private Integer Unkonw;
    /**
     * 0x00 0x00
     */
    private Integer Unkonw1;
    
    private Integer highLevel;
    private Integer lowLevel;
    
	public String getPeriodicMode() {
		return periodicMode;
	}
	public void setPeriodicMode(String periodicMode) {
		this.periodicMode = periodicMode;
	}
	public Integer getTreatment() {
		return treatment;
	}
	public void setTreatment(Integer treatment) {
		this.treatment = treatment;
	}
	public Integer getUnkonw() {
		return Unkonw;
	}
	public void setUnkonw(Integer unkonw) {
		Unkonw = unkonw;
	}
	public Integer getLength(){
		return 26;
	}
	public String getCode() {
		return "ca";
	}
	
	public Integer getHighLevel() {
		return highLevel;
	}
	public void setHighLevel(Integer highLevel) {
		this.highLevel = highLevel;
	}
	public Integer getLowLevel() {
		return lowLevel;
	}
	public void setLowLevel(Integer lowLevel) {
		this.lowLevel = lowLevel;
	}
	
	
	public Integer getUnkonw1() {
		return Unkonw1;
	}
	public void setUnkonw1(Integer unkonw1) {
		Unkonw1 = unkonw1;
	}
	public void encode( ByteBuf byteBuf){
        byteBuf.writeBytes(DecoderUtil.hexStringToBytes(this.getPeriodicMode()));
        
        if(this.getUnkonw()!=null){
        DecoderUtil.integerToBytes(this.getUnkonw(),byteBuf,2);
        }
        
        if(this.getUnkonw1()!=null){
            DecoderUtil.integerToBytes(this.getUnkonw1(),byteBuf,2);	
            }
        if(this.getTreatment()!=null){
            DecoderUtil.integerToBytes(this.getTreatment(),byteBuf,2);
            }
        if(this.getHighLevel()!=null){
        DecoderUtil.integerToBytes(this.getHighLevel(),byteBuf,4);	
        }
        if(this.getLowLevel()!=null){
        DecoderUtil.integerToBytes(this.getLowLevel(),byteBuf,4);
        }
      //22~27		全部填0x00
        byteBuf.writeBytes(DecoderUtil.hexStringToBytes("000000000000"));
        super.encode(byteBuf);
    }

}
